#region Header

/**
 * IJsonWrapper.cs
 *   Interface that represents a type capable of handling all kinds of JSON
 *   data. This is mainly used when mapping objects through JsonMapper, and
 *   it's implemented by JsonData.
 *
 * The authors disclaim copyright to this source code. For more details, see
 * the COPYING file included with this distribution.
 **/

#endregion

#region

using System;
using System.Collections;
using System.Reflection;

#endregion

namespace Json
{
  public enum JsonType
  {
    Null,
    Object,
    Array,
    String,
    Number,
    Boolean,
  }  

  public interface IWrapperFactory
  {
    IJsonWrapper CreateNull();
    IJsonWrapper CreateBoolean(bool val);
    IJsonWrapper CreateNumber(Number val);
    IJsonWrapper CreateString(string val);
    IJsonWrapper CreateArray(Type arrayType);
    IJsonWrapper CreateDictionary(Type objectType);
    IJsonWrapper CreateFromObject(object val);
  }

  public interface IJsonWrapper
  {
    #region Properties

    bool IsNull { get; }

    bool IsArray { get; }

    bool IsBoolean { get; }

    bool IsNumber { get; }

    bool IsDictionary { get; }

    bool IsString { get; }

    JsonType JsonType { get; }

    string Name { get; set; }

    bool IsNative { get; }
    
    string TypeDescriptor { get; set; }

    #endregion

    #region Public Methods

    bool GetBoolean();
    Number GetNumber();
    string GetString();
    IList GetList();
    IOrderedDictionary GetDictionary();

    object GetValue();
    Type GetValueType();
    Type GetElementType();

    IWrapperFactory GetFactory();

    #endregion
  }
}